#ifndef UHTTPINTERFACE_H
#define UHTTPINTERFACE_H

#include <QUrl>

class HttpInterface
{
public:
    HttpInterface() {}
    virtual ~HttpInterface() {}

    virtual bool getSync(const QString &url, QByteArray &resopnse, const QUrlQuery &urlQuery) = 0;

    virtual void getAsync(const QString &url, std::function<void (int, QByteArray)> resopnse, const QUrlQuery &urlQuery) = 0;

    virtual void getAsync(const QString &url, std::function<void (int, QByteArray)> progress,
                          std::function<void (int, QByteArray)> finished, const QUrlQuery &urlQuery) = 0;

    virtual bool postSync(const QUrl &url, const QByteArray &data, QByteArray &result) = 0;

    virtual void postAsync(const QUrl &url, const QByteArray &data, std::function<void (int, QByteArray)> resopnse) = 0;

    virtual bool putSync(const QUrl &url, const QByteArray &data, QByteArray &result) = 0;

    virtual void putAsync(const QUrl &url, const QByteArray &data, std::function<void (int, QByteArray)> resopnse) = 0;

    virtual void setTimeOut(int timeout) = 0;

    virtual void cancelRequest() = 0;

    virtual bool uploadFile(const QUrl &url, const QString &filePath) = 0;

    virtual bool downloadFile(const QUrl &url, const QString &filePath, std::function<void(int)> resopnse) = 0;
};

#endif // UHTTPINTERFACE_H
